<?php
	session_start();
	
	require_once("action/DAO/UserDAO.php");

	class CommonAction {
	
		protected static $publicRole = 0;
		protected static $userRole = 1;
		protected static $moderatorRole = 2;
		protected static $adminRole = 3;
		protected static $godRole = 4;
		
		private $loggedIn = false;
	
		public function __construct($roleTmp) {
			if (!isset($_SESSION["loggedIn"])) {
				$_SESSION["loggedIn"] = 0;
			}
		
			if ($_SESSION["loggedIn"] < $roleTmp) {
				header("Location:index.php");
				exit;
			}	
			
			if ($_SESSION["loggedIn"] > 0) {
				$this->loggedIn = true;
			}
		}
		
		public function isLoggedIn() {
			return $this->loggedIn;
		}
		
		public function setLoggedIn($lvl) {
			$_SESSION["loggedIn"] = $lvl;
		}
	
		public function setFullName($name) {
			$_SESSION["fullName"] = $name;
		}
		
		public function getFullName() {
			return $_SESSION["fullName"];
		}
	
	}